package com.lc1993929.mr.rating.efficienttopn;


import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 * Created by LiuChang on 2017/12/19/019.
 * 自定义排序规则，改变框架对数据分组时判断key是否相同的规则
 */
public class UidGroupingComparator extends WritableComparator {

    public UidGroupingComparator() {
        super(RateBean.class, true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        RateBean key1 = (RateBean) a;
        RateBean key2 = (RateBean) b;
        return key1.getUid().compareTo(key2.getUid());
    }
}
